
#include <bur/plctypes.h>

#ifdef _DEFAULT_INCLUDES
	#include <AsDefault.h>
#endif
#include <string.h>

void _INIT ProgramInit(void)
{
	
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// initialize default trace configuration after cold restart

	if(TraceParSave[0].Timing.TotalRecordingTime <= 0.0)
	{
		ParIdx=0;

		brsstrcpy((UDINT)&TraceParSave[ParIdx].File.FileName,			(UDINT)&"TraceData");
		brsstrcpy((UDINT)&TraceParSave[ParIdx].File.FileDevice,			(UDINT)&"Trace");
		brsstrcpy((UDINT)&TraceParSave[ParIdx].File.ColumnSeparator,	(UDINT)&";");
		brsstrcpy((UDINT)&TraceParSave[ParIdx].File.DecimalMark,		(UDINT)&",");
		
		TraceParSave[ParIdx].Timing.TotalRecordingTime	= 0.8;
		TraceParSave[ParIdx].Timing.TriggerOffsetTime	= -0.1;
		TraceParSave[ParIdx].Timing.PvTaskClass			= 1;
		TraceParSave[ParIdx].Timing.AcpSampleTime		= 0.0002;
		TraceParSave[ParIdx].Timing.AcpTraceBuffer		= ACP_TRACE_BUFFER / 1024.0;
		
		brsstrcpy((UDINT)&TraceParSave[ParIdx].StartTrigger[0].DataPointName, (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:1321");	//ENCOD0_POS_ACT
		TraceParSave[ParIdx].StartTrigger[0].Condition	= coTRACE_GOES_ABOVE_WINDOW_EVENT;
		TraceParSave[ParIdx].StartTrigger[0].Threshold	= 4300000;
		TraceParSave[ParIdx].StartTrigger[0].Window		= 0.0;
		
		CntDP=0;
	
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:1321");	//ENCOD0_POS_ACT
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:63652");	//AMR_ACTIVE_SENSOR
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:112");	//PCTRL_LAG_ERROR
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:63883");	//LLM_PCTRL_S_SET
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:63880");	//LLM_PCTRL_S_ACT
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:250");	//SCTRL_SPEED_REF
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:251");	//SCTRL_SPEED_ACT
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:213");	//ICTRL_ISQ_REF
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:218");	//ICTRL_ISD_REF
		brsstrcpy((UDINT)&TraceParSave[ParIdx].DataPointName[CntDP++], (UDINT)&"*Acp:SL1.IF1.ST1_Axis1:63887");	//LLM_CYC_CH_CTRL_BITS
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
	
	
	// load default TraceParSave[0] after cold restart
	if(gCockpTracePar.Timing.TotalRecordingTime <= 0.0)
		brsmemcpy((UDINT)&gCockpTracePar, (UDINT)&TraceParSave[0], sizeof(gCockpTracePar));

	LoadTracePar = 255;
	SaveTracePar = 255;

		

}	
